<?php

/*
 * Create by Indonesian Brain Solutions
 * E-mail : cs@mesinit.com
 * Programmer : sony@sonywibisono.com
 */
class Manufacturers {
    var $id;
    var $manufacturer;
    var $branded;
    var $website;
    var $email;
    var $phone_support;


    function open(){
        global $db;
        $sql="select * from manufacturers where id=$id";
        $row=$db->fetch_row($sql);
        if (!empty($row)){
            extract($row);
            $this->manufacturer=$manufacturer;
            $this->branded=$branded;
            $this->website=$website;
            $this->email=$email;
            $this->phone_support=$phone_support;

        }
    }

    function openAll(){
        $sql="select * from manufacturers order by id asc";
        $result=$db->query($sql);
        return $db->fetch_array($result);
        
    }

    function insert(){
    global $db;
    $sql="insert into manufacturers values (null,'{$this->manufacturer}',
'{$this->branded}','{$this->website}',
'{$this->email}','{$this->phone_support}')";
    $db->query($sql);
    return mysql_insert_id();
    }

    function update(){
        global $db;
        $sql="update manufacturers set manufacturer='{$this->manufacturer}',
branded='{$this->branded}',
website='{$this->website}',
email='{$this->email}',
phone_support='{$this->phone_support}'
 where id=".$this->id;
        $db->query($sql);
    }

    function delete(){
        global $db;
        $sql="delete from manufacturers where id=".$this->id;
        $db->query($sql);
    }

}
?>
